package com.hmy.finance.service.receipt.dto.contactorAccount;

import com.hmy.finance.api.common.enums.receipt.AccountTradeBusinessTypeEnum;
import com.hmy.finance.api.common.enums.receipt.InsufficientExpensesMethodEnum;
import com.hmy.finance.service.receipt.dto.customerAccount.CustomerExpensesDto;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 划拨DTO
 *
 * @author songkf
 */
@Data
public class TransferDto implements java.io.Serializable {

    private static final long serialVersionUID = 3562307786961180480L;

    //======================= Request Parameters =======================
    /**
     * 联系人ID
     */
    private Long contactorId;
    /**
     * 客户Id
     */
    private Long customerId;

    /**
     * 划拨金额
     */
    private BigDecimal amount;
    /**
     * Business Bill ID
     */
    private Long businessBillId;
    /**
     * Trade Business Type
     */
    private AccountTradeBusinessTypeEnum businessType;
    /**
     * Fee Incurred Time
     */
    private LocalDateTime feeIncurredTime;


    /**
     * Generate a CustomerExpensesDto object with the necessary details.
     *
     * @return the CustomerExpensesDto object generated
     */
    public CustomerExpensesDto getCustomerExpensesDto() {
        CustomerExpensesDto expensesDto = new CustomerExpensesDto();
        expensesDto.setAmount(this.getAmount());
        expensesDto.setBusinessBillId(this.getBusinessBillId());
        expensesDto.setBusinessType(this.getBusinessType());
        expensesDto.setFeeIncurredTime(this.getFeeIncurredTime());
        expensesDto.setCustomerId(this.getCustomerId());
        expensesDto.setInsufficientExpensesMethod(InsufficientExpensesMethodEnum.REFUSE);
        return expensesDto;
    }

    /**
     * Retrieves a ContactorIncomeDto object with specific details set.
     *
     * @return ContactorIncomeDto object with details set
     */
    public ContactorIncomeDto getContactorIncomeDto(Long customerExpensesTradeId) {
        ContactorIncomeDto incomeDto = new ContactorIncomeDto();
        incomeDto.setAmount(this.getAmount());
        incomeDto.setBusinessBillId(customerExpensesTradeId);
        incomeDto.setBusinessType(AccountTradeBusinessTypeEnum.AUTO);
        incomeDto.setFeeIncurredTime(this.getFeeIncurredTime());
        incomeDto.setCustomerContactorId(this.getContactorId());
        return incomeDto;
    }
}
